#include "rectangle.hpp"


Rectangle::Rectangle(int x, int y, int w, int h):
    x1(x), y1(y), x2(x+w), y2(y+h)
{ }
    
int Rectangle::w(int nw)
{
    if (nw >= 0)
	x2 = x1 + nw;
    return x2 - x1;
}

int Rectangle::h(int nh)
{
    if (nh >= 0)
	y2 = y1 + nh;
    return y2 - y1;
}
